from django.db import models

# Create your models here.
from apps.users.models import User, PlayList_Follow


class SongList(models.Model):
    """歌单信息"""
    song_list_id = models.CharField(max_length=12, verbose_name='歌单id')
    song_list_name = models.CharField(max_length=50, verbose_name='歌单名字')
    song_list_pic = models.CharField(max_length=120, verbose_name='歌单图片')
    song_list_desc = models.CharField(max_length=1000, verbose_name='歌单简介')
    song_list_like_num = models.CharField(max_length=15, verbose_name='歌单收藏量')
    song_list_play_num = models.CharField(max_length=15, verbose_name='歌单播放量')
    song_list_tag = models.CharField(max_length=30, verbose_name='歌单标签')
    song_list_create_time = models.CharField(max_length=20, verbose_name='歌单创建时间')
    song_list_category = models.IntegerField(null=True, verbose_name='歌单类别')

    class Meta:
        db_table = 'tb_SongList'
        verbose_name = '歌单'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.song_list_id


class Song(models.Model):
    """歌曲"""
    user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_like_song', null=True, verbose_name='用户')
    song_list = models.ForeignKey(PlayList_Follow, on_delete=models.CASCADE, related_name='user_like_song_list', null=True, verbose_name='歌单')

    song_id = models.IntegerField(null=True, verbose_name='歌曲id')
    song_name = models.CharField(max_length=100, verbose_name='歌曲名字')
    song_singer = models.CharField(max_length=100, verbose_name='歌手名字')
    song_singer_id = models.CharField(max_length=100, verbose_name='歌手id')
    song_album = models.CharField(max_length=100, verbose_name='专辑名字')
    song_album_id = models.CharField(max_length=100, verbose_name='专辑id')
    is_song = models.BooleanField(default=False, verbose_name='是否收藏歌曲')
    is_song_list = models.BooleanField(default=False, verbose_name='是否收藏歌单')

    class Meta:
        db_table = 'tb_Song'
        verbose_name = '歌曲'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.song_id